//
//  DLAlertView.swift
//  SwiftImprove
//
//  Created by leon on 2018/4/10.
//  Copyright © 2018年 com.leon. All rights reserved.
//

import UIKit

class DLAlertView: UIView {
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
    
        self.backgroundColor = UIColor.red;
        self.show()
    }
    
    func show() {
        
        self.transform = CGAffineTransform.init(scaleX: 0.3, y: 0.3)
        self.alpha = 0.0
        
//        UIView.animate(withDuration: 0.5, delay: 0.0, options: .curveEaseInOut, animations: {
//            self.transform = CGAffineTransform.identity
//            self.alpha = 1
//        }) { (result) in
//        }
        
        UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.4, initialSpringVelocity: 1, options: .curveEaseInOut, animations: {
            self.transform = CGAffineTransform.identity
            self.alpha = 1
        }) { (ok) in
            
        }
    }
    
}
